var options={
	page_id:103,
	grid_id:"gridList",
	sqlname:"grid_103_wx_material"
};
//document ready
$(function(){
	grid1=new uniontrip.datagrid.searchEdit(options);
	$('#addButton').bind('click',pull);
	$('#searchButton').bind('click',grid1.load);//查询操作绑定事件
    //初始化搜索框
    initsearch();
    initsessioninfo();
});

function pull(){
	$.messager.progress({interval:1000});
	$._post("/authenticated/material/pull",null,function(result){
		$.messager.progress('close');
		if(result.success){
			grid1.grid.datagrid('load');
			$.messager.alert("提示", "同步素材成功！");
		}else{
			$.messager.alert("提示","同步失败:"+result.message);
		}
	});
}
/**
 * 新增一行
 */
function addRow(){
}
/**
 * 初始化搜索条件
 */
function initsearch(){
	/*$('#search-product_class_id').combotree({
		icons: [{
			iconCls:'icon-clear',
			handler:function(){
				$('#search-product_class_id').combotree('clear');
			}
		}],
	    data:grid1.combotreeDatas.product_class_id
	});
	//初始化combobox例子
	*/
	$('#search-type').combobox({
		panelHeight:'auto',
		editable:false,
		valueField:'code_value',
		textField:'code_name',
		icons: [{
			iconCls:'icon-clear',
			handler:function(){
				$('#search-type').combobox('clear');
			}
		}],
	    data:grid1.comboboxDatas.type
	});
}